
package ch.hearc.coursJava.kitBase.exerciceTri.list;

import java.util.ArrayList;
import java.util.List;

public class UseComplexe
	{

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	public static void main(String[] args)
		{
		main();
		}

	public static void main()
		{
		exempleTri();

		exempleAffichage();
		}

	private static void exempleAffichage()
		{
		Complexe[] tab = new Complexe[2];
		tab[0] = new Complexe(5,5.5);
		tab[1] = Complexe.fromPolaire(5, 5*Math.PI);
		Complexe.afficherV2(tab);
		}

	private static void exempleTri()
		{
		exempleTriList();

		exempleTriTableauV1();

		exempleTriTableauV2();

		exempleTriTableauV3();

		exempleTriTableauV4();
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	private static void exempleTriTableauV1()
		{
		System.out.println("Tri V1.");
		Complexe[] tab = new Complexe[4];
		tab[0] = new Complexe(3, 4);
		tab[1] = new Complexe(-3, -4);
		tab[2] = new Complexe(1, 1);
		tab[3] = new Complexe(100, 100);

		Complexe.trierV1(tab);

		Complexe.afficher(tab);
		}

	private static void exempleTriTableauV2()
		{
		System.out.println("Tri V2.");
		Complexe[] tab = new Complexe[4];
		tab[0] = new Complexe(3, 4);
		tab[1] = new Complexe(-3, -4);
		tab[2] = new Complexe(1, 1);
		tab[3] = new Complexe(100, 100);

		Complexe.trierV2(tab);

		Complexe.afficher(tab);
		}

	private static void exempleTriTableauV3()
		{
		System.out.println("Tri V3.");
		Complexe[] tab = new Complexe[4];
		tab[0] = new Complexe(3, 4);
		tab[1] = new Complexe(-3, -4);
		tab[2] = new Complexe(1, 1);
		tab[3] = new Complexe(100, 100);

		Complexe.trierV3(tab);

		Complexe.afficher(tab);
		}

	private static void exempleTriTableauV4()
		{
		System.out.println("Tri V4.");
		Complexe[] tab = new Complexe[4];
		tab[0] = new Complexe(3, 4);
		tab[1] = new Complexe(-3, -4);
		tab[2] = new Complexe(1, 1);
		tab[3] = new Complexe(100, 100);

		Complexe.trierV4(tab);

		Complexe.afficher(tab);
		}

	private static void exempleTriList()
		{
		List<Complexe> list = new ArrayList<Complexe>();
		list.add(new Complexe(3, 4));
		list.add(new Complexe(-3, -4));
		list.add(new Complexe(1, 1));
		list.add(new Complexe(100, 100));

		//afficher(list);

		Complexe.trier(list);

		Complexe.afficher(list);
		}

	}
